package org.testframe;

/**
 * js允许访问的上下文
 * @author 丁常磊
 * @date 2023/11/17 11:20
 */

public class JsContextVisitor {

    private final FlowContext flowContext;

    JsContextVisitor(FlowContext flowContext) {
        this.flowContext = flowContext;
    }

    /**
     * 统计当前线程池中在执行的任务数量
     * @return
     */
    public int countRunningFlow() {
        return flowContext.getFlowBootStarter().getCurrentRunningFlowNumber();
    }

    /**
     * 读取值
     * @param key
     * @return
     */
    public Object get(String key) {
        return flowContext.get(key);
    }

}
